package com.xyz.kaptcha;

import com.google.code.kaptcha.text.TextProducer;

import java.util.Random;

public class CalculateTextProducer implements TextProducer {

    private String[] NUMBERS = {"0","1","2","3","4","5","6","7","8","9"};

    private String[] FLAGS = {"+","-","*"};

    public String getText()
    {
        StringBuffer strBuffer = new StringBuffer();
        strBuffer.append(NUMBERS[new Random().nextInt(NUMBERS.length)])
                .append(FLAGS[new Random().nextInt(FLAGS.length)])
                .append(NUMBERS[new Random().nextInt(NUMBERS.length)])
                .append("=");
        return strBuffer.toString();
    }

}
